<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .con{
           width: 100%;
           height: 60px;
           margin: 0 auto;
           box-shadow:  0px 2px 2px rgba(0, 0, 0, .2);

           position: relative;
        }
        .header{
            width: 70%;
            height: 60px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            text-align: center;
        }
        .con img{
            width: 170px;
        }
        ul{
            list-style: none;
        }
        ul > li{
            width: 100px;
            display: inline-block;
            line-height: 60px;
        }
        .footer{
            height: 200px;
            width: 100%;
            position: absolute;
            bottom: 0;
            background: rgb(155, 155, 155);
            color: #fff;
        }
        .footerUl{
            width: 70%;
            height: 160px;
            margin: 20px auto;
            background: rgb(221, 225, 217);
        }
        .avatar{
            position: absolute;
            right: 60px;
            width: 60px;
        }
        .avatar img{
            width: 30px;
            height: 30px;
        }
    </style>
</head>
<body>
    <div id="app"></div>
    <script>
        let Header = {
            template:`
            <div class="con">
                <div class="header">
                    <img :src="url" alt=""/>
                    <ul>
                        <li>联系我们</li>
                        <li>关于我们</li>
                        <li>个人主页</li>
                    </ul>
                    <div class="avatar">
                        <img v-if="regu" :src="avatar">
                        <span v-else>未登陆</span>
                    </div>
                </div>
                <h5>{{num}}</h5>
            </div>`,
            props:{
                regu:{
                    type:Boolean,
                    require:true,
                    default:true
                },
                num:{
                    type:String,
                    validator(t){
                        return t === 'aaa' || t === 'bbb'
                    }
                }
            },
            created(){
                console.log(this.regu)
            },
            data(){
                return {
                    // regu:true,
                    url:'https://by-image.oss-cn-shanghai.aliyuncs.com/yfront/static/commonbg/logo.png',
                    avatar:'https://by-image.oss-cn-shanghai.aliyuncs.com/yfront/static/offline/pic_touxiang_zyf.png'
                }
            },
        }
        let Footer = {
            template:`
            <div class="footer">
                <div class="footerUl">
                    <ul>
                        <li></li>
                    </ul>
                </div>
            </div>`,
        }
        Vue.component('ftr',Footer);//全局声明
        let Home = {
            template:`
            <div>
                <Header :regu="false" num="str"></Header>
                <Header :regu="true"></Header>
                <ftr></ftr>
            </div>`,
            components:{ Header },//局部声明
            // components:{'aaa':Header},''是给组建重命名 
            data(){
                return {
                    
                }
            }
        }
        new Vue({
            render:function(h){
                return h(Home)
            }
        }).$mount('#app')
    </script>
</body>
</html>